#ifndef COLLAPSE_H
#define COLLAPSE_H

#include "Simplex.h"
#include "Types.h"
#include "Array.h"

class Tetrahedron;
class FiniteElementModel;
class Triangle;



bool TryCollapseTriangles (FiniteElementModel*fem, Tetrahedron* t,  Real tri_aspect);

Real AspectRatio (Triangle* t);
bool TryCollapseLargeDihTetra (FiniteElementModel*fem, Tetrahedron * t,
								   Real dihedral_thresh);
bool TryCollapseCap (FiniteElementModel*fem,Tetrahedron* tet, Array<int> dihs);
bool TryCollapseSliver (FiniteElementModel*fem, Tetrahedron *t, int a1, int a2, int b1, int b2);
bool TryCollapseSpindle (FiniteElementModel*fem, Tetrahedron* t, int a, int b);
Real EdgeLength (Simplex e);

bool TryCollapseWedge (FiniteElementModel*fem, Tetrahedron *t, Real dihedral_thresh);


void SplitLongestEdge (FiniteElementModel*fem, Tetrahedron* t);
void ImproveMesh (FiniteElementModel*fem);




bool TryCollapseTriangle (FiniteElementModel*fem, Triangle* tri);
char * CollapseStatistics ();

#endif /* COLLAPSE_H */